package com.maschinenstuermer.profiler.trace.presentation;

import org.eclipse.emf.common.notify.Adapter;

import com.maschinenstuermer.profiler.trace.Invocation;
import com.maschinenstuermer.profiler.trace.provider.IRootInvocation;
import com.maschinenstuermer.profiler.trace.util.TraceAdapterFactory;

public class RootInvocationAdapterFactory extends TraceAdapterFactory {
	private Invocation root;
	
	private Adapter rootInvocationAdapter;

	public RootInvocationAdapterFactory(Invocation root) {
		super();
		this.root = root;
	}

	@Override
	public Adapter createMetricsAdapter() {
		if (rootInvocationAdapter == null) {
			rootInvocationAdapter = new RootInvocationAdapter(root);
		}
		return rootInvocationAdapter;
	}
	
	@Override
	public boolean isFactoryForType(Object type) {
		return type == IRootInvocation.class;
	}
}
